package stage1.module3.Q3;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
        Map<Student, String> var = new HashMap<>();

        Student s = new Student("a", 0);

        var.put(s, "address");

        // 1
        System.out.println("1. ");
        for (Student i : var.keySet()) {
            System.out.println(i + " : " + var.get(i));
        }
        System.out.println();

        // 2
        System.out.println("2. ");
        for (Map.Entry<Student, String> e : var.entrySet()) {
            System.out.println(e.getKey() + " : " + e.getValue());
        }
        System.out.println();

        // 3
        System.out.println("3. ");
        var.forEach((k, v) -> System.out.println(k + " : " + v));
        System.out.println();

        // 4
        System.out.println("4. ");
        Iterator<Student> i = var.keySet().iterator();
        while (i.hasNext()) {
            Student temp = i.next();
            System.out.println(temp + " : " + var.get(temp));
        }
        System.out.println();
    }
}
